home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 011 / brutil.arc / COMBINE.DOC < prev    next >
Text File  |  1988-06-01  |  3KB  |  104 lines

  1. COMBINE.COM is used to insert strings from the command line into the standard
  2. output using lines from the standard input device.
  3.  
  4. The strings are attached to the input lines as prefixes or suffixes as described
  5. in the following discussion.
  6.  
  7. When I designed the program, its primary purpose was to create commands for
  8. batch files using file names supplied from standard input along with commands
  9. and parameters from the command line.  But at least one other use has been
  10. made of the program: to insert tabs before each line of a file sent to a printer
  11. to create a left margin for printing.
  12.  
  13. Study the syntax below carefully.  Remember that even the spaces are very
  14. important.
  15.  
  16. Syntax: COMBINE [-"str1"][+"str2"][ [+"str3"][-"str4"]] ...
  17.  
  18. - for prefix string
  19. + for suffix string
  20.  
  21. Prefix and suffix strings with no spaces between them
  22. are treated as matched sets.  One or more spaces
  23. separate sets.  Each set is used to construct a line
  24. of output for each input line.  If there are two sets,
  25. there will be two lines in the output for each input
  26. line (one for each set).
  27.  
  28. It does not matter which string in a set is entered first.  If you enter two or
  29. more of the same type of string for a set, the last one is used and the
  30. previous ones are ignored and no error is indicated.
  31.  
  32. Though the prefix and suffix strings are enclosed in quotes ("), you may
  33. include quotes in those strings by entering two for each one you want.
  34.  
  35. To be sure that you understand how COMBINE works, try a few of the following
  36. examples.
  37.  
  38. COMBINE -"A"
  39. COMBINE +"B"
  40. COMBINE -"A"+"B"
  41. COMBINE -"A" +"B"
  42. COMBINE -"A"+"B" -"C"+"D"
  43. COMBINE -""""+""""
  44.  
  45. The following is a rather complex example of a batch file called @DELALQ.BAT
  46. that I wrote using this program along with a few others to delete all matching
  47. files from a disk after asking you for confirmation.  The other programs are
  48. GETKEY which sets the DOS ERRORLEVEL indicator according to the value of the
  49. key you press, WHEREIS which is my own adaptation of that program, and WC
  50. which was modified substantially from one which came with CHASM (the cheap
  51. assembler package).
  52.  
  53. @DELALQ.BAT
  54.  
  55. echo off
  56. %VDISK%WHEREIS %1/F/N >%VDISK%JUNK
  57. IF NOT ERRORLEVEL 1 GOTO OK
  58. ECHO No files to delete
  59. GOTO ERROR
  60. :OK
  61. ECHO echo off >%VDISK%JUNK.BAT
  62. %VDISK%WC/L <%VDISK%JUNK
  63. %VDISK%COMBINE -"%VDISK%GETKEY {YN} "+" ? " -"IF ERRORLEVEL 89 DEL " <%VDISK%JUNK >>%VDISK%JUNK.BAT
  64. %COMSPEC% /C %VDISK%JUNK
  65. :ERROR
  66. DEL %VDISK%JUNK.*
  67.  
  68. Here are two more examples which use another program: FILES.  That program lists
  69.  
  70. the names of files and (optionally) other information about them (if needed).
  71.  
  72. @SHOWALL.BAT
  73.  
  74. echo off
  75. %VDISK%WHEREIS %1/F >%VDISK%JUNK
  76. IF NOT ERRORLEVEL 1 GOTO OK
  77. ECHO No files to show
  78. GOTO ERROR
  79. :OK
  80. %VDISK%WC/L <%VDISK%JUNK
  81. %VDISK%GETKEY {YN} OK?
  82. IF NOT ERRORLEVEL 89 GOTO ERROR
  83. ECHO echo off >%VDISK%JUNK.BAT
  84. %VDISK%COMBINE -"FILES "+"/B/F%2" <%VDISK%JUNK >>%VDISK%JUNK.BAT
  85. %COMSPEC% /C %VDISK%JUNK
  86. :ERROR
  87. DEL %VDISK%JUNK.*
  88.  
  89. @SHOWALQ.BAT
  90.  
  91. echo off
  92. %VDISK%WHEREIS %1/F >%VDISK%JUNK
  93. IF NOT ERRORLEVEL 1 GOTO OK
  94. ECHO No files to show
  95. GOTO ERROR
  96. :OK
  97. ECHO echo off >%VDISK%JUNK.BAT
  98. %VDISK%WC/L <%VDISK%JUNK
  99. %VDISK%COMBINE -"%VDISK%GETKEY {YN} "+" ? " -"IF ERRORLEVEL 89 FILES "+"/B/F/P%2" <%VDISK%JUNK >>%VDISK%JUNK.BAT
  100. %COMSPEC% /C %VDISK%JUNK
  101. :ERROR
  102. DEL %VDISK%JUNK.*
  103. ? " -"IF ERRORLEVEL 89 FILES "+"/B/F/P%2" <%VDISK%JUNK >>%VDISK%JUNK.BAT
  104. %COMS